package NguyenNgocHungBaiTapMVCPart02;

public class StockModels {
	
	public double changePercent(Stock objStock){
		double changpercent = 0;
		if( objStock.getPreviousClosingPricc() > objStock.getCurrentPrice()){
		 changpercent = ((( objStock.getPreviousClosingPricc() - objStock.getCurrentPrice())/ objStock.getPreviousClosingPricc())*100);
		}else if( objStock.getPreviousClosingPricc() < objStock.getCurrentPrice()){
		 changpercent = (((objStock.getCurrentPrice()- objStock.getPreviousClosingPricc()) /objStock.getPreviousClosingPricc()) *100);
		}else{
			
		}
		return changpercent;
		
	}
}
